package org.lc.stk.service.baseInfo;

import lombok.RequiredArgsConstructor;
import org.lc.stk.dao.baseInfo.DepartmentTypeRepository;
import org.lc.stk.model.baseInfo.DepartmentType;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class DepartmentTypeService {
    private final DepartmentTypeRepository repository;

    public List<DepartmentType> findAll() {
        return repository.findAll();
    }

    public DepartmentType findByCode(String code) {
        return repository.findByCode(code);
    }

    public DepartmentType create(DepartmentType type) {
        return repository.save(type);
    }

    public DepartmentType update(DepartmentType type) {
        return repository.save(type);
    }

    public void delete(Integer id) {
        repository.deleteById(id);
    }
}